package graphics.tools;

import java.awt.Color;

import javax.media.j3d.AmbientLight;
import javax.media.j3d.Bounds;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.DirectionalLight;
import javax.media.j3d.PointLight;
import javax.vecmath.Color3f;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3f;

/**
 * Lighting for the universe
 * 
 * @author: Eirik Vigeland
 * @version: %I%, %G%
 */

public class Light {
	
	/**
	 * Constructor setting two Point Lights at either side of the universe.
	 * 
	 * @param bounds
	 *            Bounds where the light are be kept in.
	 * @param root
	 *            The BranchGroup to light up.
	 */

	public Light(Bounds bounds, BranchGroup root) {
			PointLight pointLight0 = new PointLight(new Color3f(Color.WHITE),
					new Point3f(1f, 1f, 1f), new Point3f(1f, 0f, 0f));

			PointLight pointLight1 = new PointLight(new Color3f(Color.WHITE),
					new Point3f(-1f, -1f, -1f), new Point3f(1f, 0f, 0f));
		
		AmbientLight amLight = new AmbientLight();
	    
			pointLight0.setInfluencingBounds(bounds);
			pointLight1.setInfluencingBounds(bounds);

		amLight.setInfluencingBounds(bounds);
		
			root.addChild(pointLight0);
			root.addChild(pointLight1);
		root.addChild(amLight);
	}

}